﻿// -------------------------------------------------------------------------
//    @FileName         :    NFScopedMessageHead.cpp
//    @Author           :    gaoyi
//    @Date             :    24-8-8
//    @Email            :    445267987@qq.com
//    @Module           :    NFScopedMessageHead
//
// -------------------------------------------------------------------------

#include "NFScopedMessageHead.h"

int32_t NFScopedMessageHead::m_iSessionGlobalID = -1;
int32_t NFScopedMessageHead::m_iCmd = 0;
uint16_t NFScopedMessageHead::m_wRequestSeq = 0;

NFScopedMessageHead::NFScopedMessageHead(int iSessionGlobalID, int iCmd, uint16_t wNetRequestSeq)
{
	m_iSessionGlobalID = iSessionGlobalID;
	m_iCmd = iCmd;
	m_wRequestSeq = wNetRequestSeq;
}

NFScopedMessageHead::~NFScopedMessageHead()
{
	m_iSessionGlobalID = -1;
	m_wRequestSeq = 0;
}

int32_t NFScopedMessageHead::GetSessionGlobalID()
{
	return m_iSessionGlobalID;
}

uint16_t NFScopedMessageHead::GetRequestSeq()
{
	return m_wRequestSeq;
}

uint16_t NFScopedMessageHead::GetStackRequestSeq(int iSessionGlobalID, int iAckCmd)
{
	if (m_iSessionGlobalID == iSessionGlobalID)
	{
		//int iCmd = BaseLayerFactory()->PacketProcessorFactory()->GetAckCmd(m_iCmd);
		int iCmd = 0;
		if (iAckCmd == 1 || iCmd == 0 || iCmd == iAckCmd)
		{
			m_iSessionGlobalID = -1;
			return m_wRequestSeq;
		}
	}
	return 0;
}
